#include "widget.h"
#include "ui_widget.h"
#include "QTimer"
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->lcdNumber->display(10);
    timer=new QTimer(this);
    connect(timer,&QTimer::timeout,this,&Widget::handle);
    timer->start(1000);
}

void Widget::handle()
{
   int i= ui->lcdNumber->intValue();
   if(i<=0)
   {
       timer->stop();
       return;
   }
   ui->lcdNumber->display(i-1);
}

Widget::~Widget()
{
    delete ui;
}

